<style>
    .rulelist {
        padding: 0 30px;
    }

    .rulelist .cailiao .select_box .ivu-select-single .ivu-select-selection {
        height: 36px !important;
    }

    .rulelist .cailiao .inputBox[data-v-1191f9a4] {
        padding-left: 0 !important;
        border: none !important;
    }

    .rulelist .ivu-select-selection {
        border: 0;
        width: 100%;
        outline: none;
        border: none !important;
    }

    .rulelist .search .ivu-select-selection {
        overflow: hidden !important;
    }

    .search .ivu-select-multiple .ivu-select-selection {
        overflow: hidden !important;
    }

    .search .ivu-select-multiple .ivu-select-selection {
        overflow: hidden !important;
    }
    #rulelistmodal .ivu-modal-body .ivu-form-item label{
        text-align:center !important;
    }
</style>
<style scoped>
    .ivu-radio-group {
        width: 100% !important;
    }

    .cailiao {
        margin: 10px 0px 15px;
    }

    .cailiao::after {
        content: '';
        display: block;
        clear: both;
    }

    .cailiao span {
        float: left;
    }

    .cailiao span:first-child {
        display: inline-block;
        width: 20%;
        height: 36px;
        line-height: 36px;
        font-size: 14px;
        border: 1px solid #A9A9A9;
        border-right: 0;
        text-align: center;
        vertical-align: middle;
        background-color: #FAFAFA;
        font-weight: 500;
    }

    .cailiao .inputBox {
        height: 36px;
        line-height: 34px;
        width: 80%;
        vertical-align: middle;
        padding-left: 5px;
        border: 1px solid #A9A9A9;
        display: inline-block;
    }

    .cailiao .select_box {
        padding: 0;
        border: none;
    }

    .cailiao .inputBox input {
        border: 0;
        width: 100%;
        outline: none;
        border: none;
    }

    .ivu-input-number:hover {
        border-color: red !important;
    }

    .ivu-input-number-focused {
        box-shadow: none !important;
    }

    .ivu-input-number {
        width: 100%;
        border: none !important;
    }
    
</style>

<template>
    <div>
        <product-title></product-title>
        <div class="rulelist">
            <div>
                <h3 class="search-h3 huang"></h3>
            </div>
            <Row>
                <Col style="text-align:right" class="mb20">
                <Button type="success" icon="plus" size="large" @click="addlist">新增</Button>
                </Col>
            </Row>
            <Row>
                <div class="table-theme highlight_table">
                    <Table :columns="column" :data="data" size="large" stripe highlight-row border @on-current-change="tablecurrent"></Table>
                </div>
            </Row>
            <Row>
                <div id="footer" class="pt20">
                    <Col :md="24" :lg="12">
                    <div style="text-align:left;">
                        <Button type="primary" class="mr10" :disabled="tabledisabled" @click="getinfo">编辑</Button>
                        <Button type="error" :disabled="tabledisabled" @click="remove">删除</Button>
                    </div>
                    </Col>
                    <!-- <Col :md="24" :lg="12" style="text-align:right">
                    <Page :total="total" show-total show-elevator show-page show-sizer class="page" @on-page-change="pagechange" placement="top"
                        @on-page-size-change="pagesizechange"></Page>
                    </Col> -->
                </div>
            </Row>
        </div>
        <Modal v-model="modal1" title="规格列表" @on-ok="ok" @on-cancel="cancelmodal1" :mask-closable="false" :closable="false">
            <Row>
                <RadioGroup v-model="disabledGroup">
                    <template v-for="item in rule_list">
                        <Col span="12" class="mb10">
                        <Radio :label="item.id">
                            <span>{{item.name}}</span>
                        </Radio>
                        </Col>
                    </template>
                </RadioGroup>
            </Row>
        </Modal>

        <Modal v-model="oneyesno" ok-text="提交" :mask-closable='closeable' :closable="false" width="600" :title='oneyes' 
             :loading="loading" class-name="common-box-body" id="rulelistmodal">
            <Form :model="first" ref="first" :rules="firstrule">
                <Row v-if="oneyes=='首年度佣金'">
                    <Col>
                    <FormItem label="名称设置" prop="name">
                        <Input v-model="first.name" size="large" type="text" placeholder="名称设置" />
                    </FormItem>
                    <div style="color:red;margin-bottom:15px;">
                        计算公式：SUM(保单标准保费1*首年度佣金率1+保单标准保费2*首年度佣金率2...)
                    </div>
                    <FormItem label="适用对象" class="search" prop="rankIds">
                        <Select multiple filterable placeholder="选择适用对象" :transfer="true" v-model="first.rankIds">
                            <Option v-for="(option, index) in comoptions" :value="option.id" :key="index">{{option.name}}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="发放周期" prop="configValue.assessmentCycleType">
                        <Select v-model="first.configValue.assessmentCycleType" placeholder="选择发放周期" :transfer="true">
                            <Option value="4">月</Option>
                            <Option value="3">季</Option>
                            <Option value="2">半年</Option>
                            <Option value="1">年</Option>
                        </Select>
                    </FormItem>
                    <div class="mt20">
                        <RadioGroup v-model="first.enabled">
                            是否启用 :
                            <Radio label="1" class="ml15">是</Radio>
                            <Radio label="0">否</Radio>
                        </RadioGroup>
                    </div>
                    </Col>
                </Row>
                <Row v-if="oneyes=='个人奖'">
                    <Col>
                    <FormItem label="名称设置" prop="name">
                        <Input v-model="first.name" size="large" type="text" placeholder="名称设置" />
                    </FormItem>
                    <div style="color:red;margin-bottom:15px;">
                        计算公式：本人FYC ×相应奖金率
                    </div>
                    <FormItem label="奖金率" prop="configValue.prizeRate">
                        <Input v-model="first.configValue.prizeRate" size="large" type="text" placeholder="奖金率设置" />
                    </FormItem>
                    <FormItem label="适用对象" class="search" prop="rankIds">
                        <Select multiple filterable placeholder="选择适用对象" :transfer="true" v-model="first.rankIds">
                            <Option v-for="(option, index) in comoptions" :value="option.id" :key="index">{{option.name}}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="发放周期" prop="configValue.assessmentCycleType">
                        <Select v-model="first.configValue.assessmentCycleType" placeholder="选择发放周期" :transfer="true">
                            <Option value="4">月</Option>
                            <Option value="3">季</Option>
                            <Option value="2">半年</Option>
                            <Option value="1">年</Option>
                        </Select>
                    </FormItem>
                    <div class="mt20">
                        <RadioGroup v-model="first.enabled">
                            是否启用 :
                            <Radio label="1" class="ml15">是</Radio>
                            <Radio label="0">否</Radio>
                        </RadioGroup>
                    </div>
                    </Col>
                </Row>
                 <Row v-if="oneyes=='团队奖'">
                    <Col>
                    <FormItem label="名称设置" prop="name">
                        <Input v-model="first.name" size="large" type="text" placeholder="名称设置" />
                    </FormItem>
                    <div style="color:red;margin-bottom:15px;">
                        计算公式：团队FYC ×相应奖金率
                    </div>
                    <FormItem label="奖金率" prop="configValue.prizeRate">
                        <Input v-model="first.configValue.prizeRate" size="large" type="text" placeholder="奖金率设置" />
                    </FormItem>
                    <FormItem label="适用对象" class="search" prop="rankIds">
                        <Select multiple filterable placeholder="选择适用对象" :transfer="true" v-model="first.rankIds">
                            <Option v-for="(option, index) in comoptions" :value="option.id" :key="index">{{option.name}}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="发放周期" prop="configValue.assessmentCycleType">
                        <Select v-model="first.configValue.assessmentCycleType" placeholder="选择发放周期" :transfer="true">
                            <Option value="4">月</Option>
                            <Option value="3">季</Option>
                            <Option value="2">半年</Option>
                            <Option value="1">年</Option>
                        </Select>
                    </FormItem>
                    <div class="mt20">
                        <RadioGroup v-model="first.enabled">
                            是否启用 :
                            <Radio label="1" class="ml15">是</Radio>
                            <Radio label="0">否</Radio>
                        </RadioGroup>
                    </div>
                    </Col>
                </Row>
                <Row v-if="oneyes=='继年度佣金'">
                    <Col>
                    <FormItem label="名称设置" prop="name">
                        <Input v-model="first.name" size="large" type="text" placeholder="名称设置" />
                    </FormItem>
                    <div style="color:red;margin-bottom:15px;">
                        计算公式：SUM(保单险种保费1*继年度佣金率1+保单险种保费2*继年度佣金率2...)
                    </div>
                    <FormItem label="适用对象 :" class="search" prop="rankIds">
                        <Select v-model="first.rankIds" multiple placeholder="选择适用对象" :transfer=true>
                            <Option v-for="(option, index) in comoptions" :value="option.id" :key="index">{{option.name}}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="发放周期" prop="configValue.assessmentCycleType">
                        <Select v-model="first.configValue.assessmentCycleType" placeholder="选择发放周期" :transfer="true">
                            <Option value="4">月</Option>
                            <Option value="3">季</Option>
                            <Option value="2">半年</Option>
                            <Option value="1">年</Option>
                        </Select>
                    </FormItem>
                    <div class="mt20">
                        <RadioGroup v-model="first.enabled">
                            是否启用 :
                            <Radio label="1" class="ml15">是</Radio>
                            <Radio label="0">否</Radio>
                        </RadioGroup>
                    </div>
                    </Col>
                </Row>

                <Row v-if="oneyes=='人力奖'">
                    <Col>
                    <FormItem label="名称设置 :" prop="name">
                        <Input v-model="first.name" size="large" type="text" placeholder="名称设置" />
                    </FormItem>
                    <FormItem label="对应人力 :">
                        <Select placeholder="选择对应人力" v-model="first.configValue.correspondingHuman">
                            <Option value="一代人力">一代人力</Option>
                            <Option value="二代人力">二代人力</Option>
                            <Option value="三代人力">三代人力</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="固定比率 :">
                        <Input v-model="first.configValue.fixRate" size="large" type="text" placeholder="固定比率" />
                    </FormItem>
                    <FormItem label="EM值(元) :">
                        <Input v-model="first.configValue.emValue" size="large" type="text" placeholder="EM值" />
                    </FormItem>
                    <div style="color:red;margin-bottom:15px;">
                        被推荐人当月FYC*固定比率
                    </div>
                    <FormItem label="发放周期">
                        <Select v-model="first.configValue.assessmentCycleType" placeholder="选择发放周期" :transfer="true">
                            <Option value="4">月</Option>
                            <Option value="3">季</Option>
                            <Option value="2">半年</Option>
                            <Option value="1">年</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="适用对象 :" class="search" prop="rankIds">
                        <Select v-model="first.rankIds" multiple :transfer=true>
                            <Option v-for="(option, index) in comoptions" :value="option.id" :key="index">{{option.name}}</Option>
                        </Select>
                    </FormItem>
                    <div class="mt20">
                        <RadioGroup v-model="first.enabled">
                            是否启用 :
                            <Radio label="1" class="ml15">是</Radio>
                            <Radio label="0">否</Radio>
                        </RadioGroup>
                    </div>
                    </Col>
                </Row>
            </Form>
            <div slot="footer" :md="24" :lg="8">
                <Button style="width:60px;" type="primary" size="small" @click="cancel">取消</Button>
                <Button style="width:60px;" class="tRight" type="success" size="small" long @click="add">确定</Button>
            </div>
        </Modal>


    </div>
</template>

<script>
    import productTitle from "../../components/productTitle";
    import util from '../../libs/util.js';
    import {
        get_all_rule,
        get_add_rule,
        get_rule_list,
        del_rule,
        get_rank
    } from '../../api/rule'
    import {
        parteGetByName
    } from '../../api/parter'
    export default {
        data() {
            return {
                addorupdate: true,
                del_id: "",
                templateId: '',
                rule_list: [],
                first: {
                    tempalteId: '',
                    name: '',
                    enabled: "",
                    rankIds: [],
                    configValue: {
                        correspondingHuman: '',
                        fixRate: '',
                        emValue: '',
                        assessmentCycleType: "",
                        ruleName:'',
                        prizeRate:'',
                    },
                    fycValue:'',
                },
                firstrule: {
                    name: [{
                        required: true,
                        message: '请输入正确姓名',
                    }],
                    'configValue.assessmentCycleType': [{
                        required: true,
                        message: '发放周期不能为空',
                        trigger: 'change',
                    }],
                    rankIds: [{
                        required: true,
                        message: '发适用对象不能为空',
                    }],
                    'configValue.prizeRate': [{
                        required: true,
                        message: '奖金率不能为空',
                    }],
                },
                closeable: false, //shif按ese按钮退出
                comoptions: [],
                value10: 20,
                oneyes: "", //首年度佣金还是续年度佣金 title
                oneyesno: false, //首年度佣金还是续年度佣金 模态框
                loading: false,
                disabledGroup: "",
                modal1: false,
                p: 1,
                pagesize: 10,
                current: {},
                tabledisabled: true,
                total: 20,
                column: [{
                        type: "index",
                        title: "序号",
                        align: "center",
                        width: "80"
                    },
                    {
                        title: "规则名称",
                        align: "center",
                        key: "name"
                    },
                    {
                        title: "使用对象",
                        align: "center",
                        key: "rankSet",
                        render: (h, params) => {
                            let rankSet = params.row.rankName;
                            rankSet = rankSet.join()
                            return h('div', rankSet)
                        }
                    },
                    {
                        title: "是否已启用",
                        align: "center",
                        key: "enabled",
                        render: (h, params) => {
                            if (params.row.enabled == true || params.row.enabled == '1') {
                                params.row.enabled = '是'
                            }
                            if (params.row.enabled == false || params.row.enabled == '2') {
                                params.row.enabled = '否'
                            }
                            return h('div', {}, params.row.enabled)
                        }
                    },

                ],
                data: [],
                rank: [],
            };
        },
        components: {
            productTitle
        },
        created() {
            this.getList();
            this.cominit();
            this.ruleall();
            // this.getrank();
        },
        methods: {
            getrank() {
                new Promise((resolve, reject) => {
                    get_rank().then(res => {
                        if (res.data.err == 0) {} else {
                            this.$Message.error(res.data.info);
                        }
                        resolve();
                    }).catch(error => {
                        reject(error);
                    });
                });
            },
            radioClick(index) {
                console.log(index, "....")
                // this.templateId = id;
            },
            inputChange(val) {

            },
            addlist() {
                //新增按钮
                this.modal1 = true;

            },
            ok() {
                this.addorupdate = true;
                if (this.disabledGroup == "402880f164172405016417241a0d0000") {
                    this.oneyes = '首年度佣金';
                    this.first.configValue.ruleName="首年度佣金";
                    this.modal1 = false;
                    this.oneyesno = true;
                    this.first.tempalteId = this.disabledGroup;
                    this.disabledGroup = "";
                } else if (this.disabledGroup == "402880f164172405016417241a1a0010") {
                    this.oneyes = '个人奖';
                    this.first.configValue.ruleName="个人奖";
                    this.modal1 = false;
                    this.oneyesno = true;
                    this.first.tempalteId = this.disabledGroup;
                    this.disabledGroup = "";
                } else if (this.disabledGroup == "402880f164172405016417241a1a0011") {
                    this.oneyes = '团队奖';
                    this.first.configValue.ruleName="团队奖";
                    this.modal1 = false;
                    this.oneyesno = true;
                    this.first.tempalteId = this.disabledGroup;
                    this.disabledGroup = "";
                } else if (this.disabledGroup == "402880f164172405016417241a1a0001") {
                    this.oneyes = '继年度佣金';
                    this.first.configValue.ruleName="继年度佣金";
                    this.modal1 = false;
                    this.oneyesno = true;
                    this.first.tempalteId = this.disabledGroup;
                    this.disabledGroup = "";
                } else if (this.disabledGroup == "402880f164172405016417241a1a0005") {
                    this.oneyes = '人力奖';
                    this.first.configValue.ruleName="人力奖";
                    this.modal1 = false;
                    this.oneyesno = true;
                    this.first.tempalteId = this.disabledGroup;
                    this.disabledGroup = "";
                } else if (this.disabledGroup == "402880f164172405016417241a1a0012") {
                    //平台奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'basic_terrace',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0012'
                        }

                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0004") {
                    //中级平台奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'prize',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0004'
                        }

                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0002") {
                    //责任底薪
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'renewal',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0002'
                        }

                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0006") {
                    //育成奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'basic_bred',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0006'
                        }
                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0007") {
                    //成长津贴
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'growth',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0007'
                        }

                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0008") {
                    //分红奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'share_money',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0008'
                        }
                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0003") {
                    //销售奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'award',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0003'
                        }
                    })
                } else if (this.disabledGroup == "402880f164172405016417241a1a0009") {
                    //增部奖
                    this.disabledGroup = "";
                    this.$router.push({
                        name: 'increase',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0009'
                        }
                    })
                }

            },
            cancelmodal1() {
                this.disabledGroup = "";
                this.modal1 = false;
                this.loading = true;
            },
            tablecurrent(current, oldcurrent) {
                this.tabledisabled = false;
                this.current = current;
                this.del_id = this.current.id;
                console.log(this.current)
            },
            getList() {
                new Promise((resolve, reject) => {
                    get_all_rule().then(res => {
                        console.log(res, "..res")
                        if (res.data.err == 0) {
                            this.data = res.data.data;
                        } else {
                            this.$Message.error(res.data.info);
                        }
                        resolve();
                    }).catch(error => {
                        reject(error);
                    });
                });
            },
            ruleall() {
                new Promise((resolve, reject) => {
                    get_rule_list().then(res => {
                        this.rule_list = res.data;
                        resolve();
                    }).catch(error => {
                        reject(error);
                    });
                });
            },
            pagechange(val) {
                this.p = val;
            },
            pagesizechange(val) {
                this.p = 1;
                this.pagesize = val;
            },
            cominit() {
                new Promise((resolve, reject) => {
                    get_rank().then(response => {
                        if (response.data.err == 0) {
                            this.comoptions = response.data.data;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    }).catch(error => {
                        reject(error);
                    });
                });
            },
            add() {
                var _this = this;
                let form = Object.assign({}, _this.first);
                form.rankIds = form.rankIds.join();
                form.configValue = JSON.stringify(form.configValue);
                form.assessmentCycleType = form.configValue.assessmentCycleType;
                this.$refs['first'].validate(valid=>{
                    if(valid){
                         if (this.addorupdate) {
                            let url =BASE_URL1+'/kb/v1/rule/salary/config/'
                            util.ajax.post(url, form).then(res => {
                                if (res.data.err == 0) {
                                    _this.$Message.success('操作成功');
                                    _this.$refs['first'].resetFields();
                                    _this.getList();
                                    _this.first = {
                                        tempalteId: '',
                                        name: '',
                                        enabled: "",
                                        rankIds: [],
                                        configValue: {
                                            correspondingHuman: '',
                                            fixRate: '',
                                            emValue: '',
                                            assessmentCycleType: "",
                                            prizeRate:'',
                                        },
                                    }
                                    location.reload();
                                } else {
                                    this.$Message.error(response.data.info);
                                }
                            })
                            .catch((res) => {
                                    console.log(res)
                                })
                        } else if (!this.addorupdate) {
                            let url = BASE_URL1+'/kb/v1/rule/salary/config/' + form.id
                            util.ajax.post(url, form).then(res => {
                                if (res.data.err == 0) {
                                    _this.$Message.success('操作成功');
                                    _this.$refs['first'].resetFields();
                                    _this.getList();
                                }
                            })
                        }
                    }else{
                        return false;
                    }
                    
                })
               
            },
            cancel() {
                this.oneyesno = false;
                this.first = {
                    tempalteId: '',
                    name: '',
                    enabled: "",
                    rankIds: [],
                    configValue: {
                        correspondingHuman: '',
                        fixRate: '',
                        emValue: '',
                        assessmentCycleType: "",
                    },
                }
                this.$refs['first'].resetFields()
            },
            remove() {
                var _this = this;
                _this.$Modal.confirm({
                    title: '提示',
                    content: '是否要删除该条记录?',
                    onOk: () => {
                        var url = BASE_URL1+'/kb/v1/rule/salary/config/' + this.del_id
                        util.ajax.delete(url, {})
                            .then(function (res) {
                                console.log(res.data.err)
                                if (res.data.err == 0) {
                                    _this.getList();
                                }
                            })
                            .catch((res) => {
                                console.log(res)
                            })
                    },
                });
            },
            getinfo() {
                var _this = this;
                _this.addorupdate = false;
                if (_this.current.templateId == "402880f164172405016417241a0d0000") {
                    _this.oneyes = '首年度佣金';
                    _this.oneyesno = true;
                    _this.first.tempalteId = _this.current.templateId;
                    var url = BASE_URL1+'/kb/v1/rule/salary/config/' + _this.current.id
                    util.ajax.get(url, {})
                        .then(function (res) {
                            if (res.data.err == 0) {
                                _this.first.id = res.data.data.id;
                                _this.first.name = res.data.data.name;
                                // _this.first.rankIds =JSON.parse(res.data.data.rankSet); 
                                _this.first.rankIds = res.data.data.rankSet;
                                _this.first.enabled = res.data.data.enabled ? '1' : '0';
                                _this.first.assessmentCycleType = res.data.data.assessmentCycleType ? res.data.data.assessmentCycleType : '';
                                _this.first.configValue = JSON.parse(res.data.data.configValue);
                            }
                        })
                        .catch((res) => {
                            console.log(res)
                        })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0010") {
                    _this.oneyes = '个人奖';
                    _this.oneyesno = true;
                    _this.first.tempalteId = _this.current.templateId;
                    var url = BASE_URL1+'/kb/v1/rule/salary/config/' + _this.current.id
                    util.ajax.get(url, {})
                        .then(function (res) {
                            if (res.data.err == 0) {
                                _this.first.id = res.data.data.id;
                                _this.first.name = res.data.data.name;
                                // _this.first.rankIds =JSON.parse(res.data.data.rankSet); 
                                _this.first.rankIds = res.data.data.rankSet;
                                // _this.first.prizeRate = res.data.data.prizeRate;
                                _this.first.enabled = res.data.data.enabled ? '1' : '0';
                                _this.first.assessmentCycleType = res.data.data.assessmentCycleType ? res.data.data.assessmentCycleType : '';
                                _this.first.configValue = JSON.parse(res.data.data.configValue);
                            }
                        })
                }  else if (_this.current.templateId == "402880f164172405016417241a1a0011") {
                    _this.oneyes = '团队奖';
                    _this.oneyesno = true;
                    _this.first.tempalteId = _this.current.templateId;
                    var url = BASE_URL1+'/kb/v1/rule/salary/config/' + _this.current.id
                    util.ajax.get(url, {})
                        .then(function (res) {
                            if (res.data.err == 0) {
                                _this.first.id = res.data.data.id;
                                _this.first.name = res.data.data.name;
                                // _this.first.rankIds =JSON.parse(res.data.data.rankSet); 
                                _this.first.rankIds = res.data.data.rankSet;
                                // _this.first.prizeRate = res.data.data.prizeRate;
                                _this.first.enabled = res.data.data.enabled ? '1' : '0';
                                _this.first.assessmentCycleType = res.data.data.assessmentCycleType ? res.data.data.assessmentCycleType : '';
                                _this.first.configValue = JSON.parse(res.data.data.configValue);
                            }
                        })
                        .catch((res) => {
                            console.log(res)
                        })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0001") {
                    _this.oneyes = '继年度佣金';
                    _this.oneyesno = true;
                    _this.first.tempalteId = _this.current.templateId;
                    var url = BASE_URL1+'/kb/v1/rule/salary/config/' + _this.current.id;
                    util.ajax.get(url, {})
                        .then(function (res) {
                            if (res.data.err == 0) {
                                _this.first.id = res.data.data.id;
                                _this.first.name = res.data.data.name;
                                _this.first.rankIds = res.data.data.rankSet;
                                _this.first.enabled = res.data.data.enabled ? '1' : '0';
                                _this.first.assessmentCycleType = res.data.data.assessmentCycleType ? res.data.data.assessmentCycleType : '';
                                _this.first.configValue.assessmentCycleType = JSON.parse(res.data.data.configValue)
                                    .assessmentCycleType;
                            }
                        })
                        .catch((res) => {
                            console.log(res)
                        })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0005") {
                    _this.oneyes = '人力奖';
                    // _this.modal1 = false;
                    _this.oneyesno = true;
                    _this.first.tempalteId = _this.current.templateId;
                    var url = BASE_URL1+'/kb/v1/rule/salary/config/' + _this.current.id;
                    util.ajax.get(url, {})
                        .then(function (res) {
                            if (res.data.err == 0) {
                                
                                _this.first.id = res.data.data.id;
                                _this.first.name = res.data.data.name;
                                _this.first.rankIds = res.data.data.rankSet;
                                _this.first.enabled = res.data.data.enabled ? '1' : '0';
                                _this.first.assessmentCycleType = res.data.data.assessmentCycleType ? res.data.data.assessmentCycleType : '';
                                _this.first.configValue.assessmentCycleType = JSON.parse(res.data.data.configValue)
                                    .assessmentCycleType;
                                _this.first.configValue.correspondingHuman = JSON.parse(res.data.data.configValue).correspondingHuman;
                                _this.first.configValue.fixRate = JSON.parse(res.data.data.configValue).fixRate;
                                _this.first.configValue.emValue = JSON.parse(res.data.data.configValue).emValue;
                                console.log(_this.first.configValue.emValue, '...')
                            }
                        })
                        .catch((res) => {
                            console.log(res)
                        })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0004") {
                    //中级平台奖
                    _this.$router.push({
                        name: 'prizeupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0004',
                            id: _this.current.id
                        }

                    })
                }  else if (_this.current.templateId == "402880f164172405016417241a1a0012") {
                    //平台
                    _this.$router.push({
                        name: 'basic_terraceupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0012',
                            id: _this.current.id
                        }

                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0002") {
                    //责任底薪
                    _this.$router.push({
                        name: 'renewalupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0002',
                            id: _this.current.id
                        }

                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0006") {
                    //育成奖
                    _this.$router.push({
                        name: 'basic_bredupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0006',
                            id: _this.current.id
                        }
                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0007") {
                    //成长津贴
                    _this.$router.push({
                        name: 'growthupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0007',
                            id: _this.current.id
                        }

                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0008") {
                    //分红奖
                    _this.$router.push({
                        name: 'share_moneyupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0008',
                            id: _this.current.id
                        }
                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0003") {
                    //销售奖
                    _this.$router.push({
                        name: 'awardupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0003',
                            id: _this.current.id
                        }
                    })
                } else if (_this.current.templateId == "402880f164172405016417241a1a0009") {
                    //增部奖
                    _this.$router.push({
                        name: 'increaseupdate',
                        params: {
                            tempalteId: '402880f164172405016417241a1a0009',
                            id: _this.current.id
                        }
                    })
                }
            }
        }
    };
</script>